package com.tidc.consumer8001.controller.found;

import com.tidc.commonality.api.StudentFoundApi;
import com.tidc.commonality.ov.UserOV;
import com.tidc.commonality.pojo.Matchs;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassNmae TeacherFoundController
 * @Description TODO
 * @Author 冯涛滔
 **/
@CrossOrigin
@RequestMapping
@RestController
public class TeacherFoundController {
	@Autowired
	StudentFoundApi studentFoundApi;
	@ApiOperation("创建比赛 需要:name(比赛名称) brief(比赛简介)  domain(比赛的领域范围) time(比赛报名结束时间)")
	@RequestMapping(value = "/teacher/found/match",method = RequestMethod.POST)
	public UserOV foundMatch( String token,  Matchs matchs){
		System.out.println(token);
		System.out.println(matchs);
		System.out.println(studentFoundApi);
		return studentFoundApi.foundMatch(token,matchs);
	}

	@ApiOperation("增加评分老师的,需要被添加的老师的email和比赛的id")
	@RequestMapping(value = "/teacher/add/power",method = RequestMethod.POST)
	public UserOV addTeacher(String token, @RequestParam("email")String email, @RequestParam("id") int id){
		return studentFoundApi.addTeacher(token,email,id);
	}

	@ApiOperation("修改比赛项目,")
	@RequestMapping(value = "/teacher/alter/match",method = RequestMethod.PUT)
	public UserOV putMatch(String token, Matchs matchs){
		return studentFoundApi.putMatch(token,matchs);
	}
}
